fix(Instrumentation-HttpClient): improve test coverage#2196
Open
GRISONRF wants to merge 9 commits intoopen-telemetry:mainfrom
Open
fix(Instrumentation-HttpClient): improve test coverage#2196GRISONRF wants to merge 9 commits intoopen-telemetry:mainfrom
GRISONRF wants to merge 9 commits intoopen-telemetry:mainfrom
Conversation
| describe 'determine_semconv' do | ||
| it 'returns "dup" when OTEL_SEMCONV_STABILITY_OPT_IN includes http/dup' do | ||
| OpenTelemetry::TestHelpers.with_env('OTEL_SEMCONV_STABILITY_OPT_IN' => 'http/dup') do | ||
| _(instrumentation.send(:determine_semconv)).must_equal('dup') |
Contributor
There was a problem hiding this comment.
@hannahramadan Is there another way to address this? It seems to me that breaking encapsulation for the purposes of testing is probably not the best way to validate this or increase coverage.
Member
There was a problem hiding this comment.
I'm not sure test coverage is an issue any longer after merging ##2272. Here is a test run with a PR that bumps up the coverage to 85% for http_client.
@thompson-tomo as the author of this ticket, can you confirm?
Contributor
There was a problem hiding this comment.
That is correct, it is no longer an issue. I was letting the pr's be reviewed as any chance to improve coverage is worthwhile.
It looks like with the latest calculation it is already 100%. So happy for this PR to be closed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2158
Changes:
Removed
skip unless ENV['BUNDLE_GEMFILE'].include?('stable')guard frominstrumentation_test.rb.Removed
#install accepts argumenttest as it caused intermittent double-prepend failures depending on test execution order (this is my first time coding in Ruby, and if I understood correctly, Ruby'sprependis permanent within a process, right? So calling install in this test file, which runs alongside other test files that also call install, can stack patches multiple times depending on random seed order, leading to unpredictable failures -please someone correct me if I'm wrong)Added explicit
determine_semconvtests to cover thedup,old, andstablebranching logic, which was previously only covered indirectly.Verified locally and all 3 appraisals pass with 0 failures, 0 errors, and coverage of 100%,
SimpleCov.minimum_coverage(85)passes, andRuboCoppasses on the changed file.